/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.tbp.controle;

import br.com.tbp.exception.PersistenciaException;
import br.com.tbp.model.domain.Endereco;
import br.com.tbp.persitence.FabricaDePersistencia;
import br.com.tbp.persitence.dao.EnderecoDao;
import java.util.List;

/**
 *
 * @author lubni
 */
public class ControleEndereco {

    public List<Endereco> pesquisar(String cep) throws PersistenciaException {
        EnderecoDao dao = FabricaDePersistencia.createEnderecoDao();
        return dao.pesquisar(cep);
    }

    public void alterar(Endereco e) throws PersistenciaException {
        EnderecoDao dao = FabricaDePersistencia.createEnderecoDao();
        dao.alterar(e);
    }

    public void cadastrar(Endereco e) throws PersistenciaException {
        EnderecoDao dao = FabricaDePersistencia.createEnderecoDao();
        dao.cadastrar(e);
    }

    public Endereco pesquisar(long id) throws PersistenciaException {
        EnderecoDao dao = FabricaDePersistencia.createEnderecoDao();
        return dao.pesquisar(id);
    }

    public int cadastrarBairro(String bairro, int codigoCidade) throws PersistenciaException {
        EnderecoDao dao = FabricaDePersistencia.createEnderecoDao();
        return dao.cadastrarBairro(bairro, codigoCidade);
    }
}
